#!/bin/sh

runtime=$1

case $runtime in
	*s)
		unit=1
		;;
	*m)
		unit=60
		;;
	*h)
		unit=3600
		;;
	*d)
		unit=$((24*3600))
		;;
	*w)
		unit=$((7*24*3600))
		;;
	*y)
		unit=$((365*24*3600))
		;;
esac

[ -n "$unit" -a "$unit" != 0 ] && runtime=$(( ${runtime%?} * unit  ))

cat >> $TMP/env.yaml <<EOF
runtime: $runtime
EOF
